package com.aigou.dao;

import com.aigou.pojo.Goods;
import com.aigou.pojo.GoodsExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface GoodsMapper {
    long countByExample(GoodsExample example);

    int deleteByExample(GoodsExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Goods record);

    int insertSelective(Goods record);

    List<Goods> selectByExample(GoodsExample example);

    Goods selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Goods record, @Param("example") GoodsExample example);

    int updateByExample(@Param("record") Goods record, @Param("example") GoodsExample example);

    int updateByPrimaryKeySelective(Goods record);

    int updateByPrimaryKey(Goods record);

    @Update("update tb_goods set num = #{num}, version = version + 1 where id = #{gid} and version = #{v}")
    int updateNum(Integer gid, int num, Long v);

    @Select("SELECT * FROM myshop.tb_goods where id=#{id} for update")
    Goods selectById(Integer id);
}